var BASEURL = 'http://58.241.85.167:8085/LYService/api/';
var BASEURL = 'http://wycms.cst-info.cn:8088/api/v2/tj/';
var BASEURL = 'http://cms.sixian.cst-info.cn:9001/api/v2/';
var BASEURLs = 'http://cms.sixian.cst-info.cn:9001/';
var imgrl = "http://cms.sixian.cst-info.cn:9001";

team = [{
	"StationName": "湾里区新时代文明实践所",
	"PointNum": "49",
	"TeamNum": "57",
	"VolunteerNum": "7366",
	"EntNum": "384",
	"TimeNum": "12879.0",
	"TeamInfo": [{
		"TeamName": "一号志愿服务支队",
		"EntNum": "4",
		"TimeNum": "1167.0"
	},
	{
		"TeamName": "二号志愿服务支队",
		"EntNum": "24",
		"TimeNum": "961.0"
	},
	{
		"TeamName": "三号志愿服务队",
		"EntNum": "9",
		"TimeNum": "931.5"
	},
	{
		"TeamName": "四号志愿服务队",
		"EntNum": "20",
		"TimeNum": "880.5"
	},
	{
		"TeamName": "五号志愿服务队",
		"EntNum": "21",
		"TimeNum": "842.0"
	},
	{
		"TeamName": "六号志愿服务队",
		"EntNum": "16",
		"TimeNum": "724.0"
	},
	{
		"TeamName": "七号志愿服务队",
		"EntNum": "19",
		"TimeNum": "676.0"
	},
	{
		"TeamName": "八号志愿服务队",
		"EntNum": "21",
		"TimeNum": "590.0"
	},
	{
		"TeamName": "九号志愿服务队",
		"EntNum": "13",
		"TimeNum": "550.0"
	},
	{
		"TeamName": "十号志愿服务队",
		"EntNum": "18",
		"TimeNum": "479.0"
	}
	]
},];

var img = [
	{
		url: "images/bigPing/1.jpg"
	},
	{
		url: "images/bigPing/3.jpg"
	}, {
		url: "images/bigPing/4.png"
	}, {
		url: "images/bigPing/5.jpg"
	}

];
var indexData = {
	activityList: [],
	init: function () {
		this.commonMethod();
		this.GetSomeCountData(); //获取中间顶部统计数据  走接口
		this.GetActivityCountData(); //获取左侧活动总数
		this.getDayEnlistList(); //，展示左侧进行中的活动  走接口
		this.VolunteHelp();//志愿帮扶
		this.GetVolunteerPMListAndGetTeamInfoPMList(); //获取志愿者风采和志愿者团队排名   四个参数没走接口  时长两个
		this.getTerraceNumber();//获取平台用户数量
		// this.getPoster(); //获取右下角轮播海报


		this.GetServiceAndActivityData(); //获取总时长和活动最多团队活动总数
		this.getVideo(); //获取右上角视频
	},

	commonMethod: function () {
		var nowDate = new Date();
		var oldDate = new Date("2019-05-20");
		var day = parseInt((nowDate.getTime() - oldDate.getTime()) / (1000 * 60 * 60 * 24));
		setTimeout(function () {
			new CountUp(".safeTime span", day, {
				duration: 5
			}).start();
		}, 500)

		$(".mask-active-quit").on("click", function () {
			$(".mask-active").hide();
			$(".mask-active-video").hide();
			$(".mask-active-contanier").hide();
			$(".mask-active-desc").hide();
		})
		$(".mask-video-quit").on("click", function () {
			$(".mask-active").hide();
			$(".mask-active-video").hide();
			$(".mask-active-contanier").hide();
			$(".mask-active-desc").hide();
		})
	},

	//获取中间顶部统计数据
	GetSomeCountData: function () {

		$.getJSON(BASEURLs + 'home/index/weather', function (res) {
			$(".noweather").html(res.data.tem_min + "℃ ~ " + res.data.tem_max + "℃ " + res.data.weather)
		})
		var now = moment().format("YYYY年MM月DD日");
		$(".nowtime").html(now)

		$.getJSON(BASEURL + 'statistics/index', function (res) {
			if (res.status == "200") {
				res = res.data;
				setTimeout(function () {
					//数字递增
					var placeCountUp = new CountUp(".place", res.center, {
						startVal: 0,
						duration: 5, //持续时长
						suffix: '' //后缀
					});
					placeCountUp.start();

					new CountUp(".station", res.place).start();
					new CountUp(".site", res.station).start();
					new CountUp(".volunteerTeam", res.volunteerGroup).start();
					new CountUp(".volunteer", res.volunteer).start();
					new CountUp(".volunteertime", res.time).start();
				}, 200)
				//团队总数
				$(".hdnum1").html(res.TeamNum);
				$(".yxnum1").html(res.VolunteerNum);
			}
		})
	},

	// 百姓点单
	GetActivityCountData: function () {
		$.getJSON(BASEURL + 'statistics/order', function (res) {
			// console.log(res);
			if (res.status == "200") {
				res = res.data;
				$(".xfnum1").html(res.order_num);
				$(".xfnum2").html(res.order_count);
				$(".xfnum3").html(res.order_activity_count);
			}
		})
	},

	//志愿帮扶
	getDayEnlistList: function () {
		var step = 7; //获取当前时间前7天 & 后7天
		var currentTime = new Date();
		var startTime = new Date(currentTime.getTime() - step * 24 * 60 * 60 * 1000);
		var endTime = new Date(currentTime.getTime() + step * 24 * 60 * 60 * 1000);
		var today = getNowFormatDate(currentTime);
		var StartDay = getNowFormatDate(startTime);
		var EndDay = getNowFormatDate(endTime);

		$.getJSON(BASEURL + 'statistics/activity', function (res) {
			// console.log(res);
			res = res.data;
			//进行数
			$('.zxnum1').html(res.activity_count);

			///站点数
			$('.zxnum3').html(res.classic_activity_count);
			//报名数
			$('.zxnum2').html(res.bm_count);

			//			更新
			var updataTimer = null;
			var upDateTime = 15 * 60 * 1000;
			(function getDayEnlistListUpdata() {
				updataTimer && clearTimeout(updataTimer);
				setTimeout(function () {
					indexData.getDayEnlistList();
				}, upDateTime)
			})()
		})
	},

	VolunteHelp: function () {
		$.getJSON(BASEURL + 'statistics/help', function (res) {
			if (res.status == "200") {
				res = res.data;
				$(".hdnum1").html(res.help_count);
				$(".hdnum2").html(res.helping);
				$(".hdnum3").html(res.finish_help_count);
			}
		})
	},
	//获取 优秀志愿者、优秀团队、志愿者和团队排名
	GetVolunteerPMListAndGetTeamInfoPMList: function () {

		$.when(
			$.getJSON(BASEURL + 'statistics/share'), //志愿者风采（优秀志愿者）
		).done(function (res) {
			// console.log(res)
			res = res.data
			$(".yxnum1").html(res.share_count);
			$(".yxnum2").html(res.service_count);
			$(".yxnum3").html(res.goodservice_count);

		}).fail(function () {

		})

		$.when(
			$.getJSON(BASEURL + 'article/articleList?pagesize=15'), //志愿者风采（优秀志愿者）
			$.getJSON(BASEURL + 'statistics/areaPMList?level=5'), //优秀团队
			$.getJSON(BASEURL + 'statistics/areaPMList?level=4'), //团队排名
			$.getJSON(BASEURL + "statistics/volunteerGroupPMList"), //志愿者排名
		).done(function (articleList, zpm, spm, GetTeamInfoPMList) { //当内部传入的ajax都执行了成功的回调, done里的函数才会被触发
			// console.log(zyzRes, teamsRes, teamsRankRes, zyzRankRes);
			articleList =articleList[0].data.items
			console.log(articleList,"articleList")

			zpm = zpm[0].data;
			spm = spm[0].data;

			//今日之星轮播

			articleList.forEach(function (v,i) {
				var artList = `<div class = swiper-slide >
									<div class="slideContent">
									<img src="${"http://fycms.cst-info.cn:9001"+v.img}" alt="">
									
									<div class="slidetitle">${v.title}</div>
									
									</div>
								</div>`
				$('.practiceDynamic').append(artList);
			})
				new Swiper('.star', {
					// effect : 'flip',
					slidesPerView: 3,
					spaceBetween: 30,
					pagination: {
						el: '.swiper-pagination',
						clickable: true,
					},
					autoplay: true,
				})
	
			


			//志愿服务队滚动轮播
			GetTeamInfoPMList[0].data.forEach(function (v, i) {
				var _teamsHTML = `<div class = active_listss >
									<div class="activity_title">
										<span>${v.rank}</span>
										<p>${v.title}</p>
									</div>
									<div class="participants">${v.activty_time}</div>
								</div>`
				$('.td-activity-lists').append(_teamsHTML);
				team[0]["TeamInfo"].push({
					TeamName: v.name,
					id: v.id,
					EntNum: v.activityCount,
					TimeNum: v.serviceTime
				});
				var roll = setInterval(function () {
					let thisContain = document.getElementById('active_contentss')
					let thisIntro = document.getElementById('activity-listss')
					//					console.log(thisContain.scrollTop, thisContain.offsetHeight, thisIntro.offsetHeight,"第二条")
					if (thisContain.scrollTop + thisContain.offsetHeight < thisIntro.offsetHeight - 1) {
						thisContain.scrollTop++
					} else {
						var thisMess = document.getElementsByClassName('active_listss')
						thisIntro.appendChild(thisMess[0])
					}
				}, 60)
			});

			// 实践所排行滚动轮播
			spm.forEach(function (v, i) {
				var _teamsHTML = `<div class = active_lists >
									<div class="activity_title">
										<span>${v.rank}</span>
										<p>${v.Name}</p>
									</div>
									<div class="participants">${v.score}</div>
								</div>`
				$('.td-activity-list').append(_teamsHTML);
				var roll = setInterval(function () {
					let thisContain = document.getElementById('active_contents')
					let thisIntro = document.getElementById('activity-lists')
					//					console.log(thisContain.scrollTop, thisContain.offsetHeight, thisIntro.offsetHeight,"第二条")
					if (thisContain.scrollTop + thisContain.offsetHeight < thisIntro.offsetHeight - 1) {
						thisContain.scrollTop++
					} else {
						var thisMess = document.getElementsByClassName('active_lists')
						thisIntro.appendChild(thisMess[0])
					}
				}, 60)
			});
			// 实践站排行滚动轮播
			zpm.forEach(function (v, i) {
				var _zyzRankHTML = `<div class = active_list >
									<div class="activity_title">
										<span>${v.rank}</span>
										<p>${v.Name}</p>
									</div>
									<div class="participants">${v.score}</div>
								</div>`
				$('.gr-activity-list').append(_zyzRankHTML);

				var roll = setInterval(function () {
					let thisContain = document.getElementById('active_content')
					let thisIntro = document.getElementById('activity-list')
					//					console.log(thisContain.scrollTop, thisContain.offsetHeight, thisIntro.offsetHeight)
					if (thisContain.scrollTop + thisContain.offsetHeight < thisIntro.offsetHeight - 1) {
						thisContain.scrollTop++
					} else {
						var thisMess = document.getElementsByClassName('active_list')
						thisIntro.appendChild(thisMess[0])
					}
				}, 60)

			});

			var zyzSwiper = null;

			//关闭弹出层
			$('.mask-zyz-close').click(function () {
				zyzSwiper.destroy(true); //销毁Swiper。销毁所有绑定的监听事件，移除鼠标键盘事件，释放浏览器内存。
				$('.mask-zyz').removeClass('maskShow').addClass('maskHide');
			})

		}).fail(function () {
			//而当有一个ajax执行失败了，fail就被触发
		});
	},



	getTerraceNumber: function () {
		setInterval(function(){
		$.getJSON(BASEURL + 'statistics/visit', function (res) {
			// console.log(res,"3333333333333333333333333333333333333");
			if (res.status == "200") {
				res = res.data;
				var terrace = `
				<li>
							<p>
								${res.pcVisit_num}
							</p>
						</li>
						<li>
							<p>
								${res.tvVisit_num}
							</p>
						</li>
						<li>
							<p>
								${res.moblieVisit_num}
							</p>
						</li>`

				$(".userFill").html(terrace)
			}

		})},1000)
	},
	//获取志愿者和团队详情
	getDetail: function (infoId, index) {
		var zyz_info_content = "志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示，志愿者详情和志愿者团体详情内容展示。";
		//去除详情里面的img标签
		if (zyz_info_content.indexOf('<img') >= 0) {
			var reg = /(<img.*?)>/gi;
			zyz_info_content = zyz_info_content.replace(reg, '');
		}
		$('.zyz-info .swiper-wrapper .swiper-slide').eq(index).find('div.zyz-info-content').html(zyz_info_content);
		/*$.getJSON(BASEURL + 'getNewsDetail?infoID=' + infoId, function(res) {
			// console.log(res);
			if(res.success == true) {
				
			}
		})*/
	},

	// 展示简介&组织架构(cms数据)
	getActivityList: function (categoryId, headTitle, leftListIndex) {
		var _this = this;
		var listIndex = 0;

		//		debugger
		if (headTitle == "基本简介") {
			var activityList = [{
				"id": pointRes[categoryId].id,
				"title": pointRes[categoryId].Name,
				"summary": pointRes[categoryId].brief
			},
			];
			activityList_then()
		} else if (headTitle == "志愿团队") {
			var activityList = [];
			$.getJSON(BASEURL + 'volunteer/volunteerGroupList', {
				area_id: pointRes[categoryId].id
			}, function (res) {
				console.log(res)
				activityList = res.data.items
				activityList_then()
			})

		} else {
			var activityList = [];
			$.getJSON(BASEURL + 'activity/activityList', {
				area_id: pointRes[categoryId].id
			}, function (res) {
				console.log(res)
				activityList = res.data.items
				activityList_then()
			})
		}

		function activityList_then(){
			if (activityList.length == 0 || (activityList.length == 1 && leftListIndex == 1)) { //如果没有组织架构也不显示
				_this.dataTips();
				return false;
			}
			$(".mask-active").show();
			$(".mask-active-contanier").show();
			$('.mask-active-contanier-left .title').html(headTitle);
			if (activityList.length > 0) {
				$(".ul-list").html("");
				for (var i = 0; i < activityList.length; i++) {
					$(".ul-list").append("<li>" + activityList[i].title + "</li>")
				}
				listIndex = leftListIndex ? leftListIndex : 0;
				$(".ul-list li:eq(" + listIndex + ")").addClass("mask-checked");

				//获取详情
				_this.getActivityInfo(activityList[listIndex].id, categoryId,headTitle);

				$(".ul-list li").on("click", function () {
					$(this).addClass("mask-checked").siblings().removeClass("mask-checked");
					_this.getActivityInfo(activityList[$(this).index()].id, categoryId,headTitle);
				})

			} else {
				$(".ul-list").html("暂无数据");
				$(".desc-time").html(" ");
				$(".desc-local").html(" ");
				$(".desc-remark-content").html(" ");
				$(".desc-summary-content").html(" ");
			}
	}
		//		})
	},
	//获取cms详情
	getActivityInfo: function (id, categoryId,headTitle) {
		if (headTitle == "基本简介") {
			$(".desc").html(pointRes[categoryId].brief);
			$('.mask-active-contanier-right-contanier').scrollTop(0);
		} else if (headTitle == "组织结构") {
			$(".desc").html("<table width='331' cellspacing='0' cellpadding='0'><colgroup><col style='width: 165px;' width='165' span='2'/></colgroup><tbody><tr class='firstRow' style='height: 18px;' height='18'><td style='text-align: center;' width='165' height='18'>姓名</td><td style='text-align: center;' width='165'>职位</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>主任</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>主任</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>副主任</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>副主任</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>副主任</td></tr><tr style='height: 18px;' height='18'><td style='text-align: center;' height='18'></td><td style='text-align: center;'>副主任</td></tr></tbody></table><p><br/></p>");
			$('.mask-active-contanier-right-contanier').scrollTop(0);
		} else if (headTitle == "实践活动") {
			$.getJSON(BASEURL + 'activity/index', {
				id: id
			}, function (res) {
				console.log(res.data)

				$(".desc").html(`
				<div class="huodongs">
				<div style="text-align: center;">${res.data.title}</div>
				<div>活动发起人：${res.data.contacter} </div>
				<div>活动地址：${res.data.address} </div>

			
				<div>活动时间：${res.data.format_start_time} - ${res.data.format_end_time}</div>
				<div>活动介绍:
				<span>${res.data.content}</span>
				
				<span></span>
				
				</div>
				<div></div>
			</div>
			
			`);
			})


			
			$('.mask-active-contanier-right-contanier').scrollTop(0);
		} else if(headTitle == "志愿团队") {
			// $(".desc").html("<p style='text-align: center;'>志愿服务队</p><p>&nbsp;&nbsp;&nbsp;&nbsp;由基层党组织中的党员、积极分子、预备党员参加，百余名同志自愿报名参加，主要提供关怀老党员、困难党员、关心关爱群众、党的理论政策宣讲等服务项目。</p><p style='text-align: center;'></p><p><br/></p>");
			// debugger
			$.getJSON(BASEURL + 'volunteer/volunteerGroup', {
				id: id
			}, function (res) {
				console.log(res.data)

				$(".desc").html(`
				<div class="huodongs">
				<div>队伍名称：${res.data.title}</div>
				<div>队长：${res.data.master} </div>
				<div>队伍联系电话：${res.data.mobile} </div>

			
				<div>创建时间：${res.data.addtime}</div>
				<div>队伍介绍:
				<span>${res.data.condition}</span>
				
				<span></span>
				
				</div>
				<div></div>
			</div>
			
			`);
			})
			$('.mask-active-contanier-right-contanier').scrollTop(0);
		}

	},

	//展示特色团队
	getActivityTeamsList: function (categoryId, headTitle) {
		var _this = this;
		_this.getActivityList(categoryId, headTitle);

		//需要先获取cms下实践所的"特色团队"子栏目
		$.getJSON('/cms/interfaces/vod/v1/listCategory?parentId=' + categoryId + '&pageNum=1&pageSize=2', function (res) {
			// console.log(res)
			var categorieList = res.categorieList;
			var _categoryId = categorieList[0].categoryId; //特色团队的categoryId
			_this.getActivityList(_categoryId, headTitle);
		})
	},





	//展示特色团队
	getHuodong: function (categoryId, headTitle) {
		var _this = this;
		_this.getActivityList(categoryId, headTitle);


	},

	//获取活动详情，展示左侧进行中的活动


	//获取总时长和活动最多团队活动总数
	GetServiceAndActivityData: function () {
		/*		$.getJSON(BASEURL + 'GetServiceAndActivityData', function(res) {
					// console.log(res)
					res = res.data[0];
					$('.yxnum2').html(res.SetviceTime);
				})*/
	},

	//获取实践所下的统计数据
	GetStationInfo: function (id, callback) {
		$.getJSON(BASEURL + 'volunteer/volunteerGroupList?area_id=' + id, function (res) {
			console.log(res)
			res = res.data;
			callback(res);
		})
	},

	//获取右下角轮播海报
	getPoster: function () {
		//		$.getJSON(BASEURL+'listInfoByCategoryId?categoryId=2920', function (res) {
		// console.log(res);
		//			if (res.code == '0') {
		//				var posterList = res.infoList;
		//				posterList.forEach(function (v, i) {
		var posterHTML = "";
		for (var i = 0; i < img.length; i++) {

			posterHTML += '<div class="swiper-slide"><img src="' + img[i].url + '" alt=""></div>';

		}
		$('.bannerBox .swiper-wrapper').append(posterHTML);
		//				})

		new Swiper('.banner-swiper-container', {
			// effect : 'cube',
			direction: 'horizontal',
			loop: true, // 循环模式选项
			autoplay: {
				delay: 5000, //停留时长
				disableOnInteraction: false //用户操作swiper之后，是否禁止autoplay。默认为true：停止。
			},
			speed: 2000, //切换速度
			mousewheel: false, //开启鼠标滚轮切换
			grabCursor: true,
			pagination: {
				el: '.swiper-pagination',
				type: 'bullets',
				clickable: true
			}
		})

		hoverPlay(); //视频控制

		//		})
	},

	//获取左上角视频
	getVideo: function () {

		$('#myVideo').attr({
			src: "video/index.mp4",
			poster: "video/index.png"
		});

		// $.getJSON(BASEURL + 'listVideo', {
		// 	categoryId: '2919',
		// 	// pageSize: 8,
		// 	// pageNum: 1,
		// 	sortBy: 'time',
		// 	scope: 'direct' //all
		// }, function(res) {
		// 	// console.log(res);
		// 	if(res.code == '0') {
		// 		res = res.videoList;
		// 		var videoList = res;

		// 		//默认加载第一个
		// 		getPlayUrl(videoList[0].id, videoList[0].name, 0);

		// 		res.forEach(function(v, i) {
		// 			var videoPoster = '/cms/' + v.posterUrl.split('/cms/')[1];
		// 			$('.video-swiper-container .swiper-wrapper').append('<div class="swiper-slide" title="' + v.name + '"><img src="' + videoPoster + '" alt="' + v.name + '"></div>')
		// 		})

		// 		//视频选择轮播
		// 		new Swiper('.video-swiper-container', {
		// 			stopOnLastSlide: true,
		// 			slidesPerView: 3, //显示的数量 可为Number和auto
		// 			spaceBetween: '4%', //间隔
		// 			freeMode: true,
		// 			mousewheel: true, //开启鼠标滚轮切换
		// 			grabCursor: true,
		// 			on: {
		// 				click: function(e) {
		// 					// alert(this.clickedIndex);
		// 					getPlayUrl(res[this.clickedIndex].id, res[this.clickedIndex].name, this.clickedIndex);
		// 				},
		// 			}
		// 		});

		// 		//获取视频地址
		// 		function getPlayUrl(assetId, assetName, index) {
		// 			$.ajax({
		// 				url: '/cms/interfaceservice/play',
		// 				data: {
		// 					assetId: assetId,
		// 					assetName: assetName,
		// 					clientId: 'test',
		// 					busiType: 'vpg'
		// 				},
		// 				dataType: 'json',
		// 				success: function(res) {
		// 					if(res.code == 0 || res.code == '0') {
		// 						var playUrl = res.content[0].url;
		// 						var posterUrl = '/cms/' + videoList[index].posterUrl.split('/cms/')[1];
		// 						playUrl = 'http://58.241.85.167:9191/' + playUrl.split('9191/')[1];
		// 						$('#myVideo').attr({
		// 							src: playUrl,
		// 							poster: posterUrl
		// 						});
		// 					}
		// 				}
		// 			})
		// 		}
		// 	}
		// })
	},

	//暂无数据提示
	dataTips: function () {
		$(".data-tips").show();
		setTimeout(function () {
			$(".data-tips").hide();
		}, 3000)
	},

	//视频活动
	getClassicVideoList: function (id) {
		var _this = this;
		var url = "/bigData/getClassicVideoList?organizationId=" + id + "&pageNo=1&pageSize=99";
		var index = 0;
		$.get(url, function (res) {
			$(".videoList").html(" ");
			var videoList = res.videoList;
			if (videoList.length == 0) {
				_this.dataTips();
				return false;
			}
			for (var i = 0; i < videoList.length; i++) {
				if (videoList[i].posterUrl == "") {
					var li = "<li><img src='images/video-bg.png' /><span>" + videoList[i].activityTitle + "</span></li>";
				} else {
					var li = "<li><img src='" + videoList[i].posterUrl + "' /><span>" + videoList[i].activityTitle +
						"</span></li>";
				}

				$(".videoList").append(li);
			}
			$(".videoList").css("width", videoList.length * 20 + (videoList.length - 1) * 0.8 + "vw");
			$(".mask-active").show();
			$(".mask-active-video").show();
			//$(".mask-active-video-left-btn").hide();
			var m = 0;
			$(".mask-active-video-left-btn").on("click", function () {
				if (index == 0) {
					$(".mask-active-video-left-btn").hide();
					return false;
				}
				$(".mask-active-video-right-btn").show();
				index--;
				m = m + 20.8;
				$(".videoList").css("margin-left", m + "vw");
			})
			$(".mask-active-video-right-btn").on("click", function () {
				if (index >= videoList.length - 3) {
					$(".mask-active-video-right-btn").hide();
					return false;
				}
				$(".mask-active-video-left-btn").show();
				index++;
				m = m - 20.8;
				$(".videoList").css("margin-left", m + "vw");
			})
			$(".videoList li").on("click", function () {
				var i = $(this).index();
				var url = videoList[i].videoUrl;
				$(".myActive-play-content").show();
				$(".mask-active-video").hide();
				chsPlayer.init(url);
			})
			$(".myActive-video-quit").on("click", function () {
				$(".myActive-play").html("");
				$(".myActive-play-content").hide();
				$(".mask-active-video").show();
			})
		})
	},

	activeList: function (obj) {
		if (obj.length == 0) {
			$(".acc-list").html("");
			$(".live-content").attr("style", "");
			$(".live-content").html("");
			$(".live-content").html("暂无直播活动！");
		} else {
			$(".acc-list").html("");
			for (var j = 0; j < obj.length; j++) {
				$(".acc-list").append("<li>" + obj[j].source + "</li>");
			}
			chsLive.init(obj[0].list[0].url);
		}
		$(".acc-list-content li").on("click", function () {
			$(".live-content").html("");
			chsLive.init(obj[0].list[$(this).index()].url);
			$(".acc-list-content").hide();
		})
	}
}

//获取年-月-日 时:分:秒
function getNowFormatDate(date) {
	var seperator1 = "-";
	var seperator2 = ":";
	var month = date.getMonth() + 1;
	var strDate = date.getDate();
	if (month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if (strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	// var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +
	// 	" " + date.getHours() + seperator2 + date.getMinutes() +
	// 	seperator2 + date.getSeconds();

	var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
	return currentdate;
}